from infirmary_admin_src.infirmary_common.infirmary_controller import IBaseController
from infirmary_admin_src.infirmary_common.infirmary_controller.rest_controller_with_depends import \
    RestControllerWithDepends
from fastapi import Request, Depends, Path, Body

from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.schemas import SchemaBase
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.services.service_businesses import \
    Businesses



class XParam(SchemaBase):
    '''
    账号密码登录参数
    '''
    pass
    appid:str= ''
    dc_number: str = ''
    si_name: str = ''
    si_number : str = ''
    stime:str = None
    etime:str = None
    ampm:str =None
    weekday:str =None
    pageNum: int = 1
    pageSize: int = 10


class IController(IBaseController):
    '''
    定制相关约束检测函数逻辑步序
    '''

    def __init__(self, *, request: Request,
                 schema_param: XParam = Depends(),
                 ):
        super().__init__(request=request)
        # 入参参数
        # 入参参数
        self.schema_param = schema_param


@RestControllerWithDepends()
class InfirmaryBusinessesDoctorSchedulingQuestListController(IController):

    def business_login(self):
        pass
        _result_nums_total, lists = Businesses.get_businesses_doctor_scheduling_query_list(
            appid=self.schema_param.appid,
            si_name = self.schema_param.si_name,
            si_number= self.schema_param.si_number,
            stime=self.schema_param.stime,
            etime=self.schema_param.etime,
            ampm =self.schema_param.ampm,
            weekday =self.schema_param.weekday,
            dc_number=self.schema_param.dc_number,pageNo=self.schema_param.pageNum,
            pageSize=self.schema_param.pageSize, is_del_select_key=[], del_flag=0,
        )


        return {
            'emptyFlag': False if _result_nums_total > 0 else True,
            'list': lists,
            'pageNum': self.schema_param.pageNum,
            'pageSize': self.schema_param.pageSize,
            'pages': _result_nums_total / len(lists) if _result_nums_total > 0 else 0,
            'total': _result_nums_total
        }
